home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / zsh.vim < prev   
Encoding:
Text File  |  2001-07-30  |  4.9 KB  |  119 lines

  1. " Vim syntax file
  2. " Language:    Z shell (zsh)
  3. " Maintainer:    Felix von Leitner <leitner@math.fu-berlin.de>
  4. " Heavily based on sh.vim by Lennart Schultz
  5. " Last Change:    2001 May 09
  6.  
  7. " For version 5.x: Clear all syntax items
  8. " For version 6.x: Quit when a syntax file was already loaded
  9. if version < 600
  10.   syntax clear
  11. elseif exists("b:current_syntax")
  12.   finish
  13. endif
  14.  
  15. " String and Character contstants
  16. " Highlight special characters (those which have a backslash) differently
  17. syn match   zshSpecial    "\\\d\d\d\|\\[abcfnrtv\\']"
  18. syn region    zshSinglequote    start=+'+ skip=+\\'+ end=+'+
  19. " A bunch of useful zsh keywords
  20. " syn keyword    zshFunction    function
  21. syn keyword    zshStatement    bg break cd chdir continue echo eval exec
  22. syn keyword    zshStatement    exit export fg getopts hash jobs kill
  23. syn keyword    zshStatement    pwd read readonly return set zshift function
  24. syn keyword    zshStatement    stop suspend test times trap type ulimit
  25. syn keyword    zshStatement    umask unset wait setopt compctl source
  26. syn keyword    zshStatement    whence disown shift which unhash unalias
  27. syn keyword    zshStatement    alias functions unfunction getln disable
  28. syn keyword    zshStatement    vared getopt enable unsetopt autoload
  29. syn keyword    zshStatement    bindkey pushln command limit unlimit fc
  30. syn keyword    zshStatement    print builtin noglob sched r time
  31. syn keyword    zshStatement    typeset declare local integer
  32.  
  33. syn keyword    zshConditional    if else esac case then elif fi in
  34. syn keyword    zshRepeat    while for do done
  35.  
  36. " Following is worth to notice: command substitution, file redirection and functions (so these features turns red)
  37. syn match    zshFunctionName    "\h\w*\s*()"
  38. syn region    zshCommandSub    start=+`+ skip=+\\`+ end=+`+
  39. " contains=ALLBUT,zshFunction
  40. syn match    zshRedir    "\d\=\(<\|<<\|>\|>>\)\(|\|&\d\)\="
  41.  
  42. syn keyword    zshTodo contained TODO
  43.  
  44. syn keyword    zshShellVariables    USER LOGNAME HOME PATH CDPATH SHELL
  45. syn keyword    zshShellVariables    LC_TYPE LC_MESSAGE MAIL MAILCHECK
  46. syn keyword    zshShellVariables    PS1 PS2 IFS EGID EUID ERRNO GID UID
  47. syn keyword    zshShellVariables    HOST LINENO MACHTYPE OLDPWD OPTARG
  48. syn keyword    zshShellVariables    OPTIND OSTYPE PPID PWD RANDOM SECONDS
  49. syn keyword    zshShellVariables    SHLVL TTY signals TTYIDLE USERNAME
  50. syn keyword    zshShellVariables    VENDOR ZSH_NAME ZSH_VERSION ARGV0
  51. syn keyword    zshShellVariables    BAUD COLUMNS cdpath DIRSTACKSIZE
  52. syn keyword    zshShellVariables    FCEDIT fignore fpath histchars HISTCHARS
  53. syn keyword    zshShellVariables    HISTFILE HISTSIZE KEYTIMEOUT LANG
  54. syn keyword    zshShellVariables    LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
  55. syn keyword    zshShellVariables    LC_TIME LINES LISTMAX LOGCHECK mailpath
  56. syn keyword    zshShellVariables    MAILPATH MANPATH manpath module_path
  57. syn keyword    zshShellVariables    MODULE_PATH NULLCMD path POSTEDIT
  58. syn keyword    zshShellVariables    PS3 PS4 PROMPT PROMPT2 PROMPT3 PROMPT4
  59. syn keyword    zshShellVariables    psvar PSVAR prompt READNULLCMD
  60. syn keyword    zshShellVariables    REPORTTIME RPROMPT RPS1 SAVEHIST
  61. syn keyword    zshShellVariables    SPROMPT STTY TIMEFMT TMOUT TMPPREFIX
  62. syn keyword    zshShellVariables    watch WATCH WATCHFMT WORDCHARS ZDOTDIR
  63. syn match    zshSpecialShellVar    "\$[-#@*$?!0-9]"
  64. syn keyword    zshSetVariables        ignoreeof noclobber
  65. syn region    zshDerefOpr    start="\${" end="}" contains=zshShellVariables
  66. syn match    zshDerefIdentifier    "\$[a-zA-Z_][a-zA-Z0-9_]*\>"
  67. syn match    zshOperator        "[][}{&;|)(]"
  68.  
  69.  
  70.  
  71. syn match  zshNumber        "-\=\<\d\+\>"
  72. syn match  zshComment    "#.*$" contains=zshNumber,zshTodo
  73.  
  74.  
  75. syn match zshTestOpr    "-\<[oeaznlg][tfqet]\=\>\|!\==\|-\<[b-gkLprsStuwjxOG]\>"
  76. "syn region zshTest           start="\[" skip="\\$" end="\]" contains=zshString,zshTestOpr,zshDerefIdentifier,zshDerefOpr
  77. syn region  zshString    start=+"+  skip=+\\"+  end=+"+  contains=zshSpecial,zshOperator,zshDerefIdentifier,zshDerefOpr,zshSpecialShellVar,zshSinglequote,zshCommandSub
  78.  
  79. " Define the default highlighting.
  80. " For version 5.7 and earlier: only when not done already
  81. " For version 5.8 and later: only when an item doesn't have highlighting yet
  82. if version >= 508 || !exists("did_zsh_syntax_inits")
  83.   if version < 508
  84.     let did_zsh_syntax_inits = 1
  85.     command -nargs=+ HiLink hi link <args>
  86.   else
  87.     command -nargs=+ HiLink hi def link <args>
  88.   endif
  89.  
  90.   HiLink zshSinglequote        zshString
  91.   HiLink zshConditional        zshStatement
  92.   HiLink zshRepeat        zshStatement
  93.   HiLink zshFunctionName    zshFunction
  94.   HiLink zshCommandSub        zshOperator
  95.   HiLink zshRedir        zshOperator
  96.   HiLink zshSetVariables    zshShellVariables
  97.   HiLink zshSpecialShellVar    zshShellVariables
  98.   HiLink zshTestOpr        zshOperator
  99.   HiLink zshDerefOpr        zshSpecial
  100.   HiLink zshDerefIdentifier    zshShellVariables
  101.   HiLink zshOperator        Operator
  102.   HiLink zshStatement        Statement
  103.   HiLink zshNumber        Number
  104.   HiLink zshString        String
  105.   HiLink zshComment        Comment
  106.   HiLink zshSpecial        Special
  107.   HiLink zshTodo        Todo
  108.   HiLink zshShellVariables    Special
  109. "  hi zshOperator        term=underline ctermfg=6 guifg=Purple gui=bold
  110. "  hi zshShellVariables    term=underline ctermfg=2 guifg=SeaGreen gui=bold
  111. "  hi zshFunction        term=bold ctermbg=1 guifg=Red
  112.  
  113.   delcommand HiLink
  114. endif
  115.  
  116. let b:current_syntax = "zsh"
  117.  
  118. " vim: ts=8
  119.